/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.netcracker.test.ten;

import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author I
 */
public class Item2 {
    RandomAccessFile rafIn = null;
    RandomAccessFile rafOut = null;
    
    public void readWrite(String path){
        try {
            long length;
            rafIn = new RandomAccessFile(path, "r");
            rafOut = new RandomAccessFile("OutFile.txt","rw");
            length = rafIn.length();
        
            for(long i = length - 1;i > -1;i--){
                rafIn.seek(i);
                rafOut.write(rafIn.read());
            }
            
            rafIn.close();
            rafOut.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Item2.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (IOException ex) {
                Logger.getLogger(Item2.class.getName()).log(Level.SEVERE, null, ex);
                System.out.println(ex);
            }
    }
}
